
package es.upm.dit.gsi.opactv;

import java.util.ArrayList;

public class Sessions {

    private static ArrayList<Session> sessions = new ArrayList();

    public static Session createSession() {
        Session session = new Session();
        sessions.add(session);
        return session;
    }

    public static Session getSessionBySID(String sid) {
        for (Session session : sessions) {
            if (session.getSID().equals(sid)) return session;
        }
        return null;
    }

    public static void deleteSessionBySID(String sid) {
        for (int i=0; i<sessions.size(); i++) {
            Session session = sessions.get(i);
            if (session.getSID().equals(sid)) sessions.remove(i);
        }
    }

}
